from django.conf.urls import url
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import obtain_jwt_token

from users import views

urlpatterns = [
    url(r'^test/$', views.TestView.as_view()),

    url(r'^test2/$',views.TestView2.as_view()),

    #判断用户名是否存在
    url(r'^usernames/(?P<username>\w{5,20})/count/$',views.UsernameCountView.as_view()),

    #注册用户
    url(r'^users/$',views.CreateUserView.as_view()),

    #查询用户详情
    url(r'^user/$',views.UserDetailView.as_view()),

    url(r'^email/$',views.EmailView.as_view()),

    url(r'^email/verification/$',views.VerifyEmailView.as_view()),

    url(r'^authorizations/$',obtain_jwt_token)

]

# users/urls.py
router = DefaultRouter()
router.register(r'addresses', views.AddressViewSet, base_name='addresses')
urlpatterns += router.urls